using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using System.Collections;

namespace eeZeeFTP
{
    public static class Parameter
    {
        //FTP Settings
        private static string sTempPath = @"c:\temp\eeZeeFTP";

        public static string TempPath
        {
            get 
            {
                try
                {
                    if (!Directory.Exists(sTempPath))
                        Directory.CreateDirectory(sTempPath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return sTempPath; 
            }
            set
            {
                sTempPath = value;
            }
        }

        public static string getTranferSpeed(double bytes, string Unit)
        {
            string speed = "0 ";

            if (bytes > 1048576)
                speed = String.Format("{0:N2} M", bytes / 1048576);
            else if (bytes > 1024)
                speed = String.Format("{0:N2} K", bytes / 1024);
            else
                speed = String.Format("{0:N2} ", bytes);

            return speed + Unit;
        }
    }
}
